<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <title>我的订单</title>

</head>
<style>
    .basic-grey {
        margin-left: auto;
        margin-right: auto;
        max-width: 600px;
        background: #F7F7F7;
        padding: 25px 15px 25px 10px;
        font: 12px Georgia, "Times New Roman", Times, serif;
        color: #888;
        text-shadow: 1px 1px 1px #FFF;
        border: 1px solid #E4E4E4;
    }
</style>
<script src="https://s3.pstatp.com/cdn/expire-1-M/jquery/3.1.1/jquery.min.js"></script>
<script>
    function pay(overtime){
        $.ajax({
            type: "post",
            url: "/order/pay",
            data: {orderId:overtime},
            success:function (data){
                location.reload();
            }
        });
    }
    function back(){
        window.location.href = "/order/addview";
    }
</script>
<script >
    setTimeout(function(){location.reload()},1000); //指定1秒刷新一次
</script>
<body>
<div class="basic-grey" >
    <button onclick="back()">返回</button>
    <h1 th:text="'['+${psnName}+']的订单'"></h1>
    <div th:each="order,olist:${rsList}">
        <label>
            <span th:text="'订单号 :'+${order.getId()}"></span>
            <span>      </span>
            <span th:text="'总价 :'+${order.getTotal()}"></span>
            <span>      </span>
            <span th:text="'下单时间 :'+${order.getCreateTime()}"></span>
            <span>      </span>
            <span th:text="'订单状态 :'+${order.getOrderStatus().getStatus()==0?'未支付':(order.getOrderStatus().getStatus()==1?'已支付':'关闭')}"></span>

            <div th:if="${order.getOrderStatus().getStatus()} eq 0">
               <span th:text="'剩余时间: '+ ${order.getLeftTime()}"></span>
                <input type="button" class="button" th:onclick="'javascript:pay('+${order.getId()}+');'" value="支付" />
            </div>
        </label>
        <label>
            <table>
                <tr>
                    <th>商品名称</th>
                    <th>商品价格</th>
                    <th>数量</th>
                </tr>

                <tr th:each="orderDetail,dlist:${order.getOrderDetails()}">
                    <td>商品名:</td>
                    <td th:text="${orderDetail.getName()}"></td>
                    <td>价格:</td>
                    <td th:text="${orderDetail.getPrice()}"></td>
                    <td>数量:</td>
                    <td th:text="${orderDetail.getNums()}"></td>
                </tr>
            </table>
        </label>
        <div>-----------------------------------------------------</div>
    </div>

</div>
</body>

</html>